﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Samples.Office.UnifiedCommunications.Gadget.Config
{
    public class ContactElement : ConfigurationElement
    {
        #region Constructors

        static ContactElement()
        {
            s_contactID = new ConfigurationProperty("contactID", typeof(string), null, ConfigurationPropertyOptions.IsKey);
            s_displayName = new ConfigurationProperty("displayName", typeof(string), null, ConfigurationPropertyOptions.None);
            s_lastUpdated = new ConfigurationProperty("lastUpdated", typeof(DateTime), DateTime.MinValue, ConfigurationPropertyOptions.None);
            s_IMTotalCount = new ConfigurationProperty("IMTotalCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_IMDayCount = new ConfigurationProperty("IMDayCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_callTotalCount = new ConfigurationProperty("callTotalCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_callDayCount = new ConfigurationProperty("callDayCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_callCommunicatorTotalCount = new ConfigurationProperty("callCommunicatorTotalCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_callCommunicatorDayCount = new ConfigurationProperty("callCommunicatorDayCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            
            s_emailTotalCount = new ConfigurationProperty("emailTotalCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_emailDayCount = new ConfigurationProperty("emailDayCount", typeof(int), 0, ConfigurationPropertyOptions.None);
            s_tagged = new ConfigurationProperty("tagged", typeof(bool), false, ConfigurationPropertyOptions.None);
            s_teamMember = new ConfigurationProperty("teamMember", typeof(bool), false, ConfigurationPropertyOptions.None);

            s_top5Weight = new ConfigurationProperty("top5Weight", typeof(decimal), (decimal)(0.0), ConfigurationPropertyOptions.None);

            s_properties = new ConfigurationPropertyCollection();

            s_properties.Add(s_contactID);
            s_properties.Add(s_displayName);
            s_properties.Add(s_lastUpdated);
            s_properties.Add(s_IMTotalCount);
            s_properties.Add(s_IMDayCount);
            s_properties.Add(s_callTotalCount);
            s_properties.Add(s_callDayCount);
            s_properties.Add(s_callCommunicatorTotalCount);
            s_properties.Add(s_callCommunicatorDayCount);
            s_properties.Add(s_emailTotalCount);
            s_properties.Add(s_emailDayCount);
            s_properties.Add(s_tagged);
            s_properties.Add(s_teamMember);
            s_properties.Add(s_top5Weight);

        }

        #endregion

        #region Static Fields
        private static ConfigurationProperty s_contactID;
        private static ConfigurationProperty s_displayName;
        private static ConfigurationProperty s_lastUpdated;
        private static ConfigurationProperty s_IMTotalCount;
        private static ConfigurationProperty s_IMDayCount;
        private static ConfigurationProperty s_callTotalCount;
        private static ConfigurationProperty s_callDayCount;
        private static ConfigurationProperty s_callCommunicatorTotalCount;
        private static ConfigurationProperty s_callCommunicatorDayCount;
        private static ConfigurationProperty s_emailTotalCount;
        private static ConfigurationProperty s_emailDayCount;
        private static ConfigurationProperty s_tagged;
        private static ConfigurationProperty s_teamMember;
        private static ConfigurationProperty s_top5Weight;


        private static ConfigurationPropertyCollection s_properties;
        #endregion

        #region Properties

        [ConfigurationProperty("contactID", IsRequired = true)]
        public string ContactID
        {
            get { return (string)base[s_contactID]; }
            set { base[s_contactID] = value; }
        }

        [ConfigurationProperty("displayName", IsRequired = true)]
        public string DisplayName
        {
            get { return (string)base[s_displayName]; }
            set { base[s_displayName] = value; }
        }

        [ConfigurationProperty("lastUpdated", IsRequired = true)]
        public DateTime LastUpdated
        {
            get { return (DateTime)base[s_lastUpdated]; }
            set { base[s_lastUpdated] = value; }
        }

        [ConfigurationProperty("IMTotalCount")]
        public int IMTotalCount {
            get { return (int)base[s_IMTotalCount]; }
            set { base[s_IMTotalCount] = value; }
        }

        [ConfigurationProperty("IMDayCount")]
        public int IMDayCount {
            get { return (int)base[s_IMDayCount]; }
            set { base[s_IMDayCount] = value; }
        }

        [ConfigurationProperty("callTotalCount")]
        public int CallTotalCount {
            get { return (int)base[s_callTotalCount]; }
            set { base[s_callTotalCount] = value; }
        }

        [ConfigurationProperty("callCommunicatorDayCount")]
        public int CallCommunicatorDayCount
        {
            get { return (int)base[s_callCommunicatorDayCount]; }
            set { base[s_callCommunicatorDayCount] = value; }
        }

        [ConfigurationProperty("callCommunicatorTotalCount")]
        public int CallCommunicatorTotalCount
        {
            get { return (int)base[s_callCommunicatorTotalCount]; }
            set { base[s_callCommunicatorTotalCount] = value; }
        }

        [ConfigurationProperty("callDayCount")]
        public int CallDayCount
        {
            get { return (int)base[s_callDayCount]; }
            set { base[s_callDayCount] = value; }
        }

        [ConfigurationProperty("emailTotalCount")]
        public int EmailTotalCount
        {
            get { return (int)base[s_emailTotalCount]; }
            set { base[s_emailTotalCount] = value; }
        }

        [ConfigurationProperty("emailDayCount")]
        public int EmailDayCount {
            get { return (int)base[s_emailDayCount]; }
            set { base[s_emailDayCount] = value; } 
        }

        [ConfigurationProperty("tagged")]
        public bool Tagged {
            get { return (bool)base[s_tagged]; }
            set { base[s_tagged] = value; } 
        }

        [ConfigurationProperty("teamMember")]
        public bool TeamMember {
            get { return (bool)base[s_teamMember]; }
            set { base[s_teamMember] = value; } 
        }

        [ConfigurationProperty("top5Weight")]
        public decimal Top5Weight
        {
            get { return (decimal)base[s_top5Weight]; }
            set { base[s_top5Weight] = value; }
        }


        protected override ConfigurationPropertyCollection Properties
        {
            get { return s_properties; }

        }

        #endregion
    }
}
